<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>window对象</title>
		<script>
			alert(typeof(window));
			window.alert("这是window："+window);
			function showWin(){
				alert("窗口大小："+window.outerHeight+","+window.outerWidth);
				alert("左顶点位置："+window.screenLeft+","+window.screenTop);
				alert("流浏览器窗口："+window.navigator.userAgent);
				console.log(window.navigator);
			}
			function gotoBaidu(){
				window.location="https://www.jd.com";
			}
			function guanbi(){
				let b=window.confirm("真的关闭吗？");
				if(b){
					window.close();//chrome禁止关闭
				}else{
					window.alert("你取消了");
				}
			}
			function openAdv(){
				//a target="_blank"
				//window.open("https://www.bdqn.cn");
				window.open("https://www.bdqn.cn","bdqn","left=200px,top=100px,height=400px,width=500px,location=0,resizable=0");
			}
			function goBack(){
				window.history.back();
			}
		</script>
	</head>
	<body>
		<input type="button" value="获得窗口大小" onclick="showWin()"/>
		
		<input type="button" value="去百度" onclick="gotoBaidu()"/>
		<input type="button" value="关闭" onclick="guanbi()"/>
		<input type="button" value="打开广告主页面" onclick="openAdv()"/>
		
		<input type="button" value="后退" onclick="goBack()"/>
	</body>
</html>